﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public DataSet QueryFSRASTER(DataRow dwData, int option = 1)
        {
            DataSet setReturn = new DataSet();
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            OracleCommand or1 = null;
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM FSRASTER WHERE  ROWNUM<2 ";
                    break;
                case 1:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "SELECT * FROM FSRASTER  "
                    + " WHERE FSRMANDANT=:FSRMANDANT AND FSRGRRAS=:FSRGRRAS";
                    or1.Parameters.Add("FSRMANDANT", OracleType.NVarChar).Value = dwData["FSRMANDANT"].ToString();
                    or1.Parameters.Add("FSRGRRAS", OracleType.NVarChar).Value = dwData["FSRGRRAS"].ToString();

                    //FSRMANDANT	FSRGRRAS

                    break;
                case 2:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "SELECT * FROM FSRASTER  "
                    + " WHERE FSRMANDANT=:FSRMANDANT";
                    or1.Parameters.Add("FSRMANDANT", OracleType.NVarChar).Value = dwData["FSRMANDANT"].ToString();
                    break;
                default:
                    break;
            }
            Result = Connect2Proxy(or1);

            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                tbLocal.TableName = "FSRASTER";
            }
            setReturn.Merge(Result);
            return setReturn;
        }
    }
}
